<template lang="">
  <div style="width:100vw;">
    <div class="header">
      <!-- 返回按钮 -->
      <!-- <mt-header fixed title="课程通知">
        <div @click="goDetail" slot="left">
          <mt-button class="back-butt" icon="back"></mt-button>
        </div>
      </mt-header> -->
    </div>
    <div class="publish-content">
      <textarea v-model="message" placeholder="请输入课程通知信息..." style="resize: none; width: 100%;padding: 20px;" name="" id="" cols="30"
        rows="10"></textarea>
    </div>
    <div class="publish-btn">
      <mt-button @click.native="publish" type="primary" size="large">发布</mt-button>
    </div>
  </div>
</template>
<style lang="less" scoped>
.publish-content {
  padding: 30/75rem;
  height: 100vh;
  background-color: #eeeeee;
}

.publish-btn {
  position: fixed;
  padding: 25/75rem 30/75rem;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ffffff;
}
</style>
<script>
import { Indicator, Toast } from "mint-ui";
import { setText } from "../../untils/ddnavigate";
export default {
  data() {
    return {
      id: "",
      message: ""
    };
  },
  mounted() {
    let { id } = this.$route.query;
    this.id = id;

    setText("课程通知");
  },
  methods: {
    goDetail() {
      this.$router.push({ path: "/myClass" });
      // push({
      //   path: '/classDetail',
      //   query: {
      //     id: id,
      //     statusNum:2
      //   }
      // })
    },
    publish() {
      let that = this;
      let { message, id } = that;
      let params = {
        courseId: id,
        message
      };
      that.$post("openMyCourse", params).then(res => {
        if (res.success) {
          Toast({
            message: "操作成功",
            iconClass: "mint-toast-icon mintui mintui-success",
            duration: 2000
          });
          setTimeout(() => {
            that.goDetail();
          }, 2000);
        }
      });
    }
  }
};
</script>
